In high-pressure processes for preparing melamine, urea is converted to melamine in an endothermic liquid-phase reaction. After removal of NH3 and CO2, a melamine melt under high pressure is obtained which is then solidified in what are called wet workup processes by quenching with water. In what are called the dry processes, as described, for example, in U.S. Pat. No. 4,565,867, WO 95/01345, WO 97/20826 and WO 99/38852, the melamine melt is solidified by quenching with ammonia, by expanding the NH3-saturated melamine melt or a melamine/NH3 suspension at a temperature just above the melting point of melamine, by sublimation with subsequent desublimation or by cooling in a fluidized bed. However, in these processes, sometimes very large amounts of gaseous NH3 are produced which, depending on pressure and temperature of the gas produced, comprise greater or lesser amounts of melamine. This already CO2-free gas can be returned to the melamine plant only in part and sometimes only with difficulties. The melamine present in the NH3 gas causes difficulties and faults, in particular in the compressors, if the NH3 gas needs to be compressed for liquification. A need therefore exists to free melamine-containing NH3 gas from melamine in a simple process.